<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
	<head>
		<base href="<%=basePath%>">
		
		<meta charset="utf-8" />
		<title></title>
		
		<meta name="description" content="overview & stats" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<link href="static/css/bootstrap.min.css" rel="stylesheet" />
		<link href="static/css/bootstrap-responsive.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="static/css/font-awesome.min.css" />
		<link rel="stylesheet" href="static/css/ace.min.css" />
		<link rel="stylesheet" href="static/css/ace-responsive.min.css" />
		<link rel="stylesheet" href="static/css/ace-skins.min.css" />
		
		<script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
		<!--提示框-->
		<script type="text/javascript" src="static/js/jquery.tips.js"></script>
</head>

<body>
	<form  action="<%=basePath%>/members/buildUser.do" name="Form" id="Form" method="post" >
		<strong style="color:red;">建议：从198开始的号码段</strong>
		<div id="centerOfMainFrame">
		<table>
			<tr class="info">
				<td><input type="text" name="startmobile" id="startmobile" placeholder="这里输入开始手机号码" value="19800000001" title="开始手机号码"/></td>
			</tr>
			<tr class="info">
				<td><input type="text" name="endmobile" id="endmobile" placeholder="这里输入结束手机号码" value="19800000006" title="结束手机号码"/></td>
			</tr>
			<tr class="info">
				<td><input type="text" name="username" id="username" placeholder="这里输入昵称" value="${pd.username }" title="昵称"/></td>
			</tr>
			<tr class="info">
				<td><input type="text" name="password" id="password" placeholder="这里输入密码" value="${pd.password}" title="密码"/></td>
			</tr>
			<tr>
				<td style="text-align: center;">
					<a class="btn btn-mini btn-primary" onclick="save();">保存</a>
					<a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
				</td>
			</tr>
		</table>
		</div>
		<div id="centerOfMainFrame2" class="center" style="display:none"><br/><br/><br/><img src="static/images/jzx.gif" style="width: 50px;" /><br/><h4 class="lighter block green"></h4></div>
	</form>
	
</body>

<script type="text/javascript">
	$(top.hangge());
	
	var msg = '${msg}';
	//alert(($("#startmobile").val().trim()).substring(0,3));
	function shuzi(str){ var s = /^[0-9]*$/; return s.test(str); }
		 
	//保存
	function save(){
		var sml=$("#startmobile").val().trim();
		var eml=$("#endmobile").val().trim();
		if(shuzi(sml)&&shuzi(eml)){
			if(sml.length==11&&eml.length==11){
				if(parseInt(sml)<parseInt(eml)){
					if(sml.substring(0,3)!="198"||eml.substring(0,3)!="198"){
						alert("建议：从198开始的号码段");
						return ;
					}	
				}else{
					alert("开始手机号必须小于结束手机号");
					return ;
				}
				
			}else{
				alert("开始结束手机号必须满足等于11位");
				return ;
			}
		}
		
		
		if($("#username").val()==""){
			
			$("#username").tips({
				side:3,
	            msg:'请输入昵称',
	            bg:'#AE81FF',
	            time:2
	        });
			
			$("#username").focus();
			return false;
		}
		
		if($("#startmobile").val()=="" || $("#startmobile").val()=="此手机号码必须为11位!"){
			
			$("#startmobile").tips({
				side:3,
	            msg:'请输入开始手机号码',
	            bg:'#AE81FF',
	            time:2
	        });
			
			$("#startmobile").focus();
			$("#startmobile").val('');
			$("#startmobile").css("background-color","white");
			return false;
		}
		
		if($("#endmobile").val()=="" || $("#endmobile").val()=="此手机号码必须为11位!"){
			
			$("#endmobile").tips({
				side:3,
	            msg:'请输入结束机号码',
	            bg:'#AE81FF',
	            time:2
	        });
			
			$("#endmobile").focus();
			$("#endmobile").val('');
			$("#endmobile").css("background-color","white");
			return false;
		}
		
		
		
		if($("#password").val()==""){
			$("#password").tips({
				side:1,
	            msg:'请输入密码',
	            bg:'#AE81FF',
	            time:2
	        });
			
			
			$("#password").focus();
			return false;
		}
		
		$("#Form").submit();
		$("#centerOfMainFrame").hide();
		$("#centerOfMainFrame2").show();
		
		
	}
	
	
</script>

</html>